package com.levenx.vo;

import com.fasterxml.jackson.annotation.JsonIgnore;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class MenuNode implements Serializable {

    private Integer id;

    @JsonIgnore
    private Integer pid;

    private String name;

    private String path;

    private String icon;

    private Boolean redirect = false;

    private Boolean selected = false;

    private List<MenuNode> children = new ArrayList<>();

    public MenuNode() {
    }

    public MenuNode(Integer id, String name, String path) {
        this.id = id;
        this.name = name;
        this.path = path;
    }

    public MenuNode(Integer id, String name, String path, String icon, Boolean redirect, List<MenuNode> children) {
        this.id = id;
        this.name = name;
        this.path = path;
        this.icon = icon;
        this.redirect = redirect;
        this.children = children;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public MenuNode id(Integer id){
        this.id = id;
        return this;
    }

    public MenuNode id(Object id){
        this.id = Integer.valueOf(id.toString());
        return this;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public MenuNode name(String name){
        this.name = name;
        return this;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public MenuNode path(String path){
        this.path = path;
        return this;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public MenuNode icon(String icon){
        this.icon = icon;
        return this;
    }

    public Boolean getRedirect() {
        return redirect;
    }

    public void setRedirect(Boolean redirect) {
        this.redirect = redirect;
    }

    public MenuNode redirect(Boolean redirect){
        this.redirect = redirect;
        return this;
    }

    public List<MenuNode> getChildren() {
        return children;
    }

    public void setChildren(List<MenuNode> children) {
        this.children = children;
    }

    public MenuNode children(List<MenuNode> children){
        this.children = children;
        return this;
    }

    public Integer getPid() {
        return pid;
    }

    public void setPid(Integer pid) {
        this.pid = pid;
    }

    public MenuNode pid(Integer pid){
        this.pid = pid;
        return this;
    }

    public MenuNode pid(Object pid){
        if(null != pid){
            this.pid = Integer.valueOf(pid.toString());
        }
        return this;
    }

    public Boolean getSelected() {
        return selected;
    }

    public void setSelected(Boolean selected) {
        this.selected = selected;
    }

    public MenuNode selected(Boolean selected){
        this.selected = selected;
        return this;
    }
}
